package com.reggie.config;

import com.reggie.intercepter.LoginInterceptor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.InterceptorRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

@Configuration
public class WebConfig implements WebMvcConfigurer {
    @Autowired
    LoginInterceptor loginInterceptor;

    @Override
    public void addInterceptors(InterceptorRegistry registry) {
        registry.addInterceptor(loginInterceptor).excludePathPatterns(
                "/backend/api/**",
                "/backend/images/**",
                "/backend/js/**",
                "/backend/plugins/**",
                "/backend/styles/**",
                "/backend/page/login/login.html",
                "/backend/favicon.ico",
                "/employee/login",

                "/front/api/**",
                "/front/images/**",
                "/front/js/**",
                "/front/plugins/**",
                "/front/styles/**",
                "/front/page/login.html",
                "/front/favicon.ico",
                "/user/login"
        );
    }
}
